<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>crawler</title>
    <script src="${request.contextPath}/statics/libs/jquery.min.js"></script>

</head>
<body>
<p>欢迎使用crawler爬虫工具</p>
查询的网站：<input type="text" id="inpt"  placeholder="有种你就填">
<input type="button" onclick="saveOrUpdate()" value="确定"/>
<script>
    $(function () {

    })
    var cont =0;
    var isok =true;
    var interval;
    var shuju =[716,717,718,719,720,721,728,729,730,
        734,735,739,743,745,746,748,750,752,756,
        829,830,831,838,894,904,913,1008,1014];
    function saveOrUpdate() {
        interval =setInterval('saveOrUpdatexun()', 1000); ;
    }
    function saveOrUpdatexun(){
        if(isok){
            if(cont<shuju.length){
                $.ajax({
                    type: "POST",
                    url:"/api/crawler/wenda",
                    async: false,
                    cache: true,

                    data:{crawlurl:"http://baike.1kuang.com/baike-"+shuju[cont]+".html"},
                    success: function(r){
                        if(r.code == 0){
                            cont++;
                            isok =true;
                            console.log("asaaaaaaaaa+cont::"+cont+"       zhaugtissn:::::::"+shuju[cont]);
                        }else{
                            alert(r.msg);
                        }
                    },
                    beforeSend:function () {
                        isok=false;
                        console.log("开始发送：：：cont："+cont+"       zhaugtissn:::::::"+shuju[cont]);
                    }
                });
            }else{
                console.log("结束！！！！")
                clearInterval(interval);
            }
        }
    }

</script>
</body>
</html>